package threadDemo;

class Task implements Runnable{
	private int[] dataSrc;
	
	public Task(int[] dataSrc) {
		this.dataSrc = dataSrc;
	}
	@Override
	public void run(){
		int len = dataSrc.length;
		for (int i = 0; i < (len <= 3 ? 10 : len); i++) {
			System.out.println(dataSrc[i]);
		}
		System.out.println("end");
	}
}

public class Demo1 {
	public static void main(String[] args) throws InterruptedException {
		Thread t1 = new Thread(new Task(new int[]{1,2,3}));
		
		int[] arr = new int[100];
		for (int i = 0; i < arr.length; i++) {
			arr[i] = i;
		}
		
		Thread t2 = new Thread(new Task(arr));
		t1.start();
		t2.start();
		t2.sleep(1);
	}

}
